# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-rpi-gpio
pkgname=('python2-rpi-gpio' 'python-rpi-gpio')
_pkgname=RPi.GPIO
pkgver=0.7.1
pkgrel=4
pkgdesc='A module to control Raspberry Pi GPIO channels.'
arch=('x86_64' 'aarch64')
url='https://pypi.org/project/rpi-gpio/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/RPi.GPIO-$pkgver.tar.gz")
sha512sums=('6c8a7411be3e2cbf52b3faed63b95d52163a19b64c8778f08a0f22d53403740e044c91383c512d2c5148f6b24c60bfdecd3ffc5601791c4b8d36101d3f0f9d0b')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-rpi-gpio() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

package_python-rpi-gpio() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

